package cocurrency.queue;

import java.util.concurrent.BlockingQueue;

/**
 * Created by luzl on 4/6/2017.
 */
public class Consumer extends Thread {
    BlockingQueue<String> queue;

    public Consumer(BlockingQueue<String> queue){
        this.queue=queue;
    }

    public void run(){
        while (true){
            try {
                String message=queue.take();
                System.out.println("Get message =>"+message);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
